package com.bjpowernode.javase.collection.map;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class MergeMap {

    private static Map<String, Employee> map1 = new HashMap<>();
    private static Map<String, Employee> map2 = new HashMap<>();

    public static void main(String[] args) {
        Employee employee1 = new Employee(1L, "Henry");
        map1.put(employee1.getName(), employee1);
        Employee employee2 = new Employee(22L, "Annie");
        map1.put(employee2.getName(), employee2);
        Employee employee3 = new Employee(8L, "John");
        map1.put(employee3.getName(), employee3);

        Employee employee4 = new Employee(2L, "George");
        map2.put(employee4.getName(), employee4);
        Employee employee5 = new Employee(3L, "Henry");
        map2.put(employee5.getName(), employee5);

        List<Map> list = new ArrayList<>();
        Map map0 = new HashMap();
        map0.put(1, 1);
        list.add(map0);
        Map map1 = new HashMap();
        map1.put(3, 4);
        list.add(map1);
        Map map2 = new HashMap();
        map2.put(1, 2);
        list.add(map2);
        Map map3 = new HashMap();
        map3.put(1, 3);
        list.add(map3);
        Map map4 = new HashMap();
        map4.put(2, 2);
        list.add(map4);
        Map map5 = new HashMap();
        map5.put(2, 1);
        list.add(map5);
        Map map6 = new HashMap();
        map6.put(3, 1);
        list.add(map6);
        list.stream().forEach(System.out::println);

    }
}


 class Employee {
     private Long id;
     private String name;

     public Employee() {
     }

     public Employee(Long id, String name) {
         this.id = id;
         this.name = name;
     }

     public Long getId() {
         return id;
     }

     public void setId(Long id) {
         this.id = id;
     }

     public String getName() {
         return name;
     }

     public void setName(String name) {
         this.name = name;
     }

     @Override
     public String toString() {
         return "Employee{" +
                 "id=" + id +
                 ", name='" + name + '\'' +
                 '}';
     }
 }
